#A copier dans /usr/lib/pidgin/

use Purple;

%PLUGIN_INFO = (
    perl_api_version => 2,
    name => "aaaChange Pseudo",
    version => "0.1",
    summary => "Change le pseudo selon l'endroit ou vous etes",
    description => "",
    author => "Metalgun <alexmoatti\@hotmail.fr",
    url => "http://metalgun.dyndns.org/",
    load => "plugin_load",
    unload => "plugin_unload"
);
sub plugin_init {
    return %PLUGIN_INFO;
}
sub plugin_load {
    my $plugin = shift;
    use constant account_name => "alexmoatti\@hotmail.fr";
    my $protocol="prpl-msn";
    Purple::Debug::info("testplugin", "plugin_load() - Test Plugin Loaded.\n");
    Purple::Debug::info("testplugin", "account_name\n");
    $account = Purple::Accounts::find(account_name, $protocol);
	Purple::Debug::info("testplugin", "$account\n");
    $user_name = $account->get_username();
  #  $alias =  Purple::get_blist();
    $name = Purple::find_buddy($account,account_name);
    
    Purple::Debug::info("testplugin","Username => $user_name\n");
   # Purple::Debug::info("testplugin", "Alias => $alias\n");
    Purple::Debug::info("testplugin","nom => $name"); 
    
    #$alias= $account->get_alias();
    
    
    
    
}
sub plugin_unload {
    my $plugin = shift;
    Purple::Debug::info("testplugin", "plugin_unload() - Test Plugin Unloaded.\n");
}
sub current_ip {
	my $protocol = "prpl-oscar";
    my $account_name = "test";
    # Create a new Account
    print "Testing: Purple::Account::new()... ";
    $account = Purple::Account->new($account_name, $protocol);
    if ($account) { print "ok.\n"; } else { print "fail.\n"; }
    # Add a new Account
    print "Testing: Purple::Account::add()...";
    Purple::Accounts::add($account);
    print "pending find...\n";
    # Find the account we just added to verify its existence
    print "Testing: Purple::Accounts::find()...";
    $account = Purple::Accounts::find($account_name, $protocol);
    if ($account) { print "ok.\n"; } else { print "fail.\n"; }
    # Return the username
    print "Testing: Purple::Account::get_username()... ";
    $user_name = $account->get_username();
    if ($user_name) {
        print "Success: $user_name.\n";
    } else {
        print "Failed!\n";
    }
    # Verify if the user is connected
    print "Testing: Purple::Account::is_connected()";
    if ($account->is_connected()) {
        print " Connected.\n";
    } else {
        print " Disconnected.\n";
    }
		
}


